package org.example.what_mall.dto;

import lombok.Data;
import org.example.what_mall.entity.Comment;
import org.example.what_mall.entity.Spec;
import org.example.what_mall.entity.User;
import org.example.what_mall.vo.UserCommentVO;

import java.time.LocalDateTime;

@Data
public class CommentDTO {
    private UserCommentVO user;
    private Integer score;
//    private String specName;
    private String comment;
    private LocalDateTime time;


    public static CommentDTO of(User u, Comment comment) {
        CommentDTO dto = new CommentDTO();

        dto.user = UserCommentVO.of(u);
        dto.score = comment.getScore();
//        dto.specName = spec.getSpecName();
        dto.comment = comment.getContent();
        dto.time = comment.getTime();

        return dto;
    }
}
